package top.shmly.universal.base.response;

/**
 * 异常代码
 * http 协议规范为主
 *
 * @author
 */
public enum ResponseCode {

    /**
     * 请求成功
     */
    CODE_200(200, "请求成功"),
    /**
     * 系统未捕获异常
     */
    CODE_400(400, "请求失败,请稍后重试"),
    /**
     * 系统未捕获异常
     */
    CODE_401(401, "认证授权失败,请重试"),
    /**
     * 系统捕获异常
     */
    CODE_500(500, "请求错误,请稍后重试"),
    /**
     * 系统捕获异常
     */
    CODE_510(510, "没有权限访问资源,请检查权限"),
    /**
     * 并发异常 并发时可能出现此类异常，其下有若干子类异常来标识乐观锁和获取锁失败这两类异常信息
     */
    CODE_900(900, "请求过于频繁,请稍后再试"),
    CODE_901(901, "方法请求错误"),
    CODE_902(901, "请求频率限制"),

    CODE_1000(1000, "{0}"),
    CODE_1001(1001, "参数错误"),
    CODE_1002(1002, "非法请求"),
    CODE_1003(1003, "请求失败，请重新操作"),
    CODE_1004(1004, "用户未登录"),
    CODE_1005(1005, "登录状态已过期"),
    CODE_1006(1006, "您没有足够权限操作，请联系管理员。"),
    CODE_1007(1007, "账号不存在，请先注册帐号"),
    CODE_1008(1008, "账号不存在"),
    CODE_1009(1009, "密码输入不正确，还可以输入{0}次"),
    CODE_1010(1010, "您手机号码未注册，请先注册账号"),
    CODE_1011(1011, "操作失败，请稍后重试"),
    CODE_1012(1012, "{0}"),
    CODE_1013(1013, "验证码不正确，请重新获取验证码"),
    CODE_1019(1019, "找不到对应的url请仔细核对,或者参数错误"),
    CODE_1020(1020, "账号不存在，或未启用"),
    CODE_1102(1102, "短信发送过于频繁，请{0}秒后再试"),
    CODE_1103(1103, "手机号已绑定其他账号"),
    CODE_1104(1104, "已绑定手机号码"),


    CODE_1311(1311, "密码不正确超过{0}次，请{1}分钟后重新登录"),
    CODE_1312(1312, "请求错误，异常：{0}"),
    CODE_1313(1313, "用户账户初始化失败，请联系客服，或稍后重试"),
    CODE_1314(1314, "方法执行异常"),
    CODE_1315(1315, "请输入正确的手机号码"),
    CODE_1316(1316, "请输入手机号码"),
    CODE_1317(1317, "已经是注册用户了"),
    CODE_1318(1318, "密码由6~20位英文字母、数字组成"),
    CODE_1319(1319, "推荐码不存在"),
    CODE_1321(1321, "验证码不正确，请检查后重试"),
    CODE_1322(1322, "密码不正确"),
    CODE_1323(1323, "冻结"),
    CODE_1324(1324, "异常"),
    CODE_1325(1325, "注销"),
    CODE_1326(1326, "文件上传异常"),
    CODE_1327(1327, "使用优惠券异常"),
    CODE_1328(1328, "没有可开票的订单"),
    CODE_1329(1329, "当前订单状态不可评价"),
    CODE_1330(1330, "未完成任务"),
    CODE_1331(1331, "奖励已发放哦"),
    CODE_1332(1332, "奖励已失效"),
    CODE_1333(1333, "活动已过期"),
    CODE_1334(1334, "领取奖励需要关注公众号哦~"),
    CODE_1335(1335, "缺少发票抬头"),
    CODE_1336(1336, "当前订单已申请发票，请耐心等待"),
    CODE_1337(1337, "当前订单不可申请发票"),
    CODE_1338(1338, "奖励未发放"),
    CODE_1339(1339, "套餐已售罄"),
    CODE_1340(1340, "套餐兑换信息不存在"),
    CODE_1341(1341, "当前状态不可申请补领"),
    CODE_1342(1342, "已经申请过补领，不可重复申请"),
    CODE_1343(1343, "当前订单状态不可取消"),
    CODE_1344(1344, "特惠套餐详情信息不存在"),
    CODE_1345(1345, "已经领取完了"),
    CODE_1346(1346, "未生效"),
    CODE_1347(1347, "已失效"),
    CODE_1348(1348, "已兑换，请重试"),
    CODE_1349(1349, "超出可兑换金额"),
    CODE_1350(1350, "信息不存在"),
    CODE_1351(1351, "当前机器不可兑换"),
    CODE_1352(1352, "选择月卡套餐领取次数必须为4的倍数"),

//    ================================分割线=================================

    CODE_1500(1500, "商品已下架"),
    CODE_1501(1501, "地址信息不存在，请刷新重试"),
    CODE_1502(1502, "库存不足"),
    CODE_1503(1503, "部分商品已下架"),
    CODE_1504(1504, "订单走丢了，请重新下单"),
    CODE_1505(1505, "订单已经付过款啦，不要重复支付哦"),
    CODE_1506(1506, "当前订单已经支付啦，不能关闭哦"),
    CODE_1507(1507, "未付款"),
    CODE_1508(1508, "订单已关闭"),
    CODE_1509(1509, "订单已退款"),
    CODE_1510(1510, "未发货"),
    CODE_1511(1511, "已申请退款，请勿重复申请"),
    CODE_1512(1512, "优惠券不存在"),
    CODE_1513(1513, "未到满减条件"),
    CODE_1514(1514, "订单信息不存在"),
    CODE_1515(1515, "优惠券抵扣失败，稍后重试"),
    CODE_1516(1516, "优惠券已失效"),
    CODE_1517(1517, "退款数量有误"),
    CODE_1518(1518, "当前订单 【{0}】 限制购买{1}件"),

    //    ================================管理后台=================================
    CODE_2000(2000, "商品分类删除失败，选择分类包含上架商品，请先下架"),
    CODE_2001(2001, "未查找到商品信息"),
    CODE_2002(2002, "商品删除失败，选择包含已上架商品，请先下架"),
    CODE_2003(2003, "商品类型删除失败，选择分类包含已上架商品，请先下架"),
    CODE_2004(2004, "上架失败"),
    CODE_2005(2005, "下架失败"),
    CODE_2010(2010, "删除失败"),
    CODE_2011(2011, "创建失败"),
    CODE_2012(2012, "更新失败"),
    CODE_2013(2013, "启用失败"),
    CODE_2014(2014, "停用失败"),
    CODE_2015(2015, "删除失败"),
    CODE_2016(2016, "查询失败，ID不能为空"),
    CODE_2020(2020, "退款订单查找失败"),
    CODE_2021(2021, "人气商品创建失败，此商品已是人气商品"),
    CODE_2022(2022, "微信退款失败"),
    CODE_2023(2023, "人气商品已满三十个，请移除后添加"),
    CODE_2024(2024, "当前下架时间已过期，请确认"),
    CODE_2025(2025, "商品退款金额必须小于实际付款金额"),
    CODE_2026(2026, "活动信息更新失败，请确认要删除商品"),
    CODE_2100(2100, "用户信息查找失败"),
    CODE_2200(2200, "优惠卷发放失败，库存不足"),
    CODE_2201(2201, "已超过当前活动分类的数量限制，请确认"),
    CODE_2202(2202, "活动价格超过原售价，请确认"),
    CODE_2203(2203, "未查找到符合的优惠卷信息"),
    CODE_2204(2204, "当前发票号已经使用，请确认"),
    CODE_9999(9999, "");


    private int code;
    private String desc;

    ResponseCode(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }


    public static ResponseCode changeMethod(int code) {
        return Enum.valueOf(ResponseCode.class, "CODE_" + code);
    }
}
